import fetchJsonp from 'fetch-jsonp'
const  GetLocationInfo = 'https://apis.map.qq.com/ws/geocoder/v1/';
export function getLocationInfo (location) {
  return new Promise((resolove) => {
    let url = `${GetLocationInfo}?key=${import.meta.env.VITE_QQ_KEY}&output=jsonp`
    if (location) url += `&location=${location}`
    fetchJsonp(url).then(response => {
      response.json().then(res => {
        resolove(res.result)
      })
    })
  })
}